package com.cn.wanxi.util;

import java.io.*;

public class MyIO {

    public static String saveFile(String path, String fileName) {

        File file = new File(path, fileName);
        if (!file.exists()) {
            return "nofile";
        }
        try {
//            Reader reader = new FileReader(file);
            InputStream inputStream = new FileInputStream(file);
            String savePath = "E:\\wanxi\\step-four\\restaurant04-1029\\out\\artifacts\\restaurant04_1029_war_exploded\\loadImg\\";
            savePath = savePath + fileName;
            OutputStream outputStream = new FileOutputStream(savePath);//这里面的file应该是写的地址
            int result;
            while ((result = inputStream.read()) != -1) {
                outputStream.write(result);
            }
//            System.out.println(stringBuilder);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "success";
    }
}
